package com.mk.juc;

import java.util.concurrent.TimeUnit;

class Test {
    public static synchronized void t1() throws InterruptedException {
        TimeUnit.SECONDS.sleep(3);
        System.out.println("t1");
    }

    public synchronized void t2() {
        System.out.println("t2");
    }

    public void t3(){
        System.out.println("t3");
    }
}


public class demo1 {
    public static void main(String[] args) throws InterruptedException {
        Test test = new Test();
        Test test1 = new Test();
        new Thread(() -> {
            try {
                test.t1();
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }).start();

        new Thread(() -> {
            try {
                test1.t1();
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }).start();
//        Thread.sleep(1);
//        new Thread(test::t2).start();

//        new Thread(test::t3).start();
    }
}